<?php 
	if(!isset($geoMap) || !is_object($geoMap))
	{
		$html->initHelper("GeoMap");
		$geoMap = $html->GeoMap;
	}
	$region = '';
	if(cr('Geo.region'))
	{
		$region = 'region='.cr('Geo.region');
	}
	if(!isset($this->params['isAjax']) || !$this->params['isAjax']){?>
	<script type="text/javascript" src="<?php echo 'http://maps.google.com/maps/api/js?sensor=false&'.$region?>"></script>
	<script type="text/javascript" src="<?php echo $html->url("/js/geomap.js")?>"></script>
	<script type="text/javascript" src="<?php echo $html->url("/js/infobubble.js")?>"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo $html->url('/css/geomap.css')?>" />
<?php }?>
<?php 
	if(!isset($width))
	{
		$width = "200px";
	}
	if(!isset($height))
	{
		$height  = "200px";
	}
	//@MAPAJAXHK - MAP AJAX HACK
	$hoverEvent = true;
	if(isset($detectType) && $detectType!= "auto")
	{
		$hoverEvent = false;
	}
	$makers = $geoMap->getListingsMarker($listingData);
	$makersJson = $javascript->object($makers);?>
	<div id="map_container_index" class="">
		<div id="cofig_strip">
		<?php if($follow_user){?>
		<?php echo $form->input("stop_following",array("label"=>"Stop following","id"=>"StopFollowing",'type'=>"checkbox"))?><br/><br/>
		<?php }?>
		</div>
	<div id="map_index" style="<?php echo "width:".$width.";height:".$height.";z-index:100;"?>">
	
	</div>
</div>
<script>
	<?php //@MAPAJAXHK?>
	var floatingDiv = <?php echo $follow_user ? "true" : "false"?>;
	var hoverEvent = <?php echo $hoverEvent ? "true" : "false"; ?>;
	$(document).ready(function(){
		if(floatingDiv)
		{
			$('#StopFollowing').change(function(){
				if($(this).attr('checked') == true)
				{
					var stop = true;
				}else
				{
					var stop = false;
					}
				$('#map_container_index').data('noFixDiv',stop);
			});
			$('#map_container_index').fixedDiv({fixAfter:$('#listing_block'),fixTill:$('#listing_block')});
		}
		makeListingMap('map_index',<?php echo $makersJson?>,hoverEvent);
})
</script>